<template>
  <div v-if="!initLoading">
    <diy :diyData="diyData"></diy>
  </div>
  <initLoad ref="initLoadRef" v-if="initLoading"></initLoad>
</template>

<script setup lang="ts">
import { ref, getCurrentInstance, onMounted, nextTick } from "vue";
import diy from "@/components/diy/index.vue";
import initLoad from "@/components/ui/init-load/index.vue";
import { onShow } from "@dcloudio/uni-app";
import { diyPageDataType } from "@/types";
import { useConfig } from "@/store";

const configStore = useConfig();

const {
  proxy,
  proxy: { $utils },
} = getCurrentInstance() as any;

const diyData = ref<any>();

const initLoading = ref<boolean>(true);

const initLoadRef = ref<HTMLElement>();

onShow(() => {
  var diydata = configStore.getDiyData;
  if (diydata) {
    initLoading.value = false;
    diyData.value = diydata;
    nextTick(() => {
      proxy?.$refs["initLoadRef"]?.close();
    });
  }
});

onMounted(() => {});
</script>

<style scoped>
</style>
